package com.ctshk.rpc.goods.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ctshk.rpc.goods.dto.ShoppingShopStoreDTO;
import com.ctshk.rpc.goods.dto.ShoppingShopStoreDetailedDTO;
import com.ctshk.rpc.goods.entity.ShoppingShopStore;
import com.ctshk.rpc.goods.mapper.provider.ShoppingShopStoreDetailedProvider;
import com.ctshk.rpc.goods.mapper.provider.ShoppingShopStoreProvider;
import com.ctshk.rpc.goods.req.ShoppingShopStorePageReq;

/**
 * <p>
 * 小店管理 Mapper 接口
 * </p>
 *
 * @author 姜斌文
 * @since 2021-04-07
 */
public interface ShoppingShopStoreMapper extends BaseMapper<ShoppingShopStore> {

    @SelectProvider(type = ShoppingShopStoreProvider.class, method = "findShoppingShopStoreByCondition")
    IPage<ShoppingShopStoreDTO> findShoppingShopStoreByCondition(IPage<ShoppingShopStoreDTO> page, ShoppingShopStorePageReq pageReq);

    @SelectProvider(type = ShoppingShopStoreDetailedProvider.class, method = "findShoppingShopStoreDetailedByCondition")
    IPage<ShoppingShopStoreDetailedDTO> findShoppingShopStoreDetailedByCondition(IPage<ShoppingShopStoreDetailedDTO> page, ShoppingShopStorePageReq pageReq);

    @Select("SELECT t.id, t.store_invitation_code, t.head_portrait_url, t.store_type, t.store_name, t.store_type, t.customer_service_hotline, t.email, t.corporate_name, t.shop_name, t.shop_id, t.staff_id, t.staff_name, t.staff_type, t.store_id, t.shop_type, t.status, t.create_id, t.modified_id, t.personnel_type " +
            "from `ctshk-goods`.t_shopping_shop_store t " +
            "where t.is_deleted = 0 and t.id = #{id}")
    ShoppingShopStore findShoppingShopStoreDetailById(@Param("id") Long id);
}
